{include file="index/_meta" /}
    <title>商家登录</title>
</head>
<body>
<div class="loginContent" id="app">
    <van-nav-bar
            title="商家登录"
            left-text="返回"
            left-arrow
            @click-left="window.history.back();"
    ></van-nav-bar>

    <van-form @submit="onSubmit">
        <van-field
                v-model="form.username"
                name="username"
                label="用户名"
                placeholder="用户名"
                required
                clearable
                clickable
                :rules="[{ required: true, message: '请填写用户名' }]"
        ></van-field>
        <van-field
                v-model="form.password"
                type="password"
                name="password"
                label="密码"
                placeholder="密码"
                required
                clearable
                clickable
                :rules="[{ required: true, message: '请填写密码' }]"
        ></van-field>
        <p style="text-align: left;font-size: 12px;color: #ddd;">账号默认为手机号，密码为初始密码</p>
        <div style="margin: 50px 16px 16px 16px;">
            <van-button round block type="info" native-type="submit">
                提交
            </van-button>
        </div>
    </van-form>
<script>
    new Vue({
        el: "#app",
        data(){return{
            form:{
                username:'',
                password:'',
            }
        }},
        created(){},
        methods:{
            onSubmit(values) {
                console.log('submit', values);
                let that =this
                axios.post("{:url('store/checkLogin')}",that.form).then(function (res) {
                    let ret = res.data
                    if (ret.code == 0){
                        vant.Notify({type:'success',message:ret.msg,duration:1000,onClose:function () {
                                window.location.href = "{:url('store/index')}"
                            }})
                    }else{
                        vant.Notify({type:'danger',message:ret.msg,duration: 1000})
                    }
                })
            },
        },
    })
</script>
</div>
</body>
</html>
